package zhx;

/**
 * @author Yancy
 * @program springioctest
 * @create 2021-03-08
 */
public class Test {

  public static void main(String[] args) {
    //
    int[] intArr = {0, 2, 9, 4, 1, 6, 8, 7};
    for (int a :sort(intArr)){
      System.out.println(a);
    }
  }

  public static int[] sort(int[] arr) {

    for (int i = 0; i < arr.length-1; i++) {

      for (int j = 0; j < arr.length - i-1; j++) {

        if (arr[j] > arr[j + 1]) {
          int x = 0;
          x = arr[j + 1];
          arr[j + 1] = arr[j];
          arr[j] = x;
        }
      }
    }

    return arr;
  }
}
